package com.ng.service;

import com.ng.entity.Book;
import com.ng.mapper.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ProjectName: springMvc01->BookServiceImpl
 * Description: TODO：
 * Author: 丘丘
 * DateTime: 2024/12/27 08:25
 */
@Service  // 愿意被容器管理
public class BookServiceImpl implements BookService{
    // 自动装配mapper
    @Autowired
    private BookMapper bookMapper;
    @Override
    public List<Book> selectAllBooks() {
        return bookMapper.selectAllBooks();
    }

    @Override
    public Book selectBookById(int id) {
        return bookMapper.selectBookById(id);
    }

    @Override
    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    @Override
    public int insertBook(Book book) {
        return bookMapper.insertBook(book);
    }

    @Override
    public int updateBook(Book book) {
        return bookMapper.updateBook(book);
    }

    @Override
    public List<Book> selectBookByBookName(String bookName) {
        return bookMapper.selectBookByBookName(bookName);
    }
}
